<template>
	<view class="bgIndex " :style="{ '--bg-image': `url(${bgCenter})` }">
		<!-- 头像 -->
		<view class="flex-between " style="padding-top: 170rpx;">
			<view class="flex-start-center ">
				<image class="avatar" :src="userInfoObject.avatar" mode=""></image>
				<view class="margin-left_20rpx">
					<view class="flex-start-center">
						<view class="font-weight margin-right_16rpx font-overflow"
							style="margin-bottom: 10rpx;max-width: 250rpx;">
							{{userInfoObject.nickname?userInfoObject.nickname:''}}
						</view>
						<view class="">
							<view v-if="userInfoObject.level_id==1" class="">
								<image class="noVip" src="https://z4a.net/images/2024/07/17/-1617.png" mode="widthFix">
								</image>
							</view>
							<view class="" v-if="userInfoObject.level_id!=1">
								<image class="Vip" src="https://z4a.net/images/2024/07/17/-1134.png" mode="widthFix">
								</image>
							</view>
						</view>

					</view>

					<view class="flex-start-center">
						<view class="editingDegree flex" @click="toMaterialFn()">
							<text style="margin-bottom: 3rpx;">编辑度{{percentage}}%</text>

						</view>




					
							<view class="male flex" v-if="userInfoObject.sex==1||userInfoObject.sex==0">
								<image v-if="userInfoObject.sex==1||userInfoObject.sex==0" class="maleImg" :src="path25" mode="widthFix"></image>
							
								<text>{{userInfoObject.age}}</text>
							
							</view>
							<view class="female flex" v-if="userInfoObject.sex==2">
							
								<image v-if="userInfoObject.sex==2" class="femaleImg" :src="path69" mode="aspectFit">
								</image>
								<text>{{userInfoObject.age}}</text>
							
							</view>
				




						<!-- 	<text
							style="margin-right: 10rpx;">{{userInfoObject.introduce?userInfoObject.introduce:userInfoObject.phone}}</text> -->

					</view>

				</view>
			</view>
			<view class="flex collectBricks" @click="rechargeNowFn()">
				<image class="bricksImg" :src="yellowBrick" mode=""></image>
				<view class="">
					<text style="color: #ED783A;">立即{{isAndroid?'充值 ':'兑换'}}</text>
				</view>
			</view>
		</view>
		<view class="flex-around dataDetails">
			<view class="flex-column" v-for="(item,i) in dataDetails" :key="i" @click="tabFollowFn(item)">
				<view class="font-weight" style="color: #333333;font-size: 36rpx;">
					{{totelName(item.number)}}
				</view>
				<view style="color: #666666;font-size: 24rpx;margin-top: 10rpx;">
					{{item.text}}
				</view>
			</view>

		</view>
		<view class="bgBlock flex-between">
			<view class="flex-start-center">
				<image class="crownImg" :src="crowns" mode=""></image>
				<view style="color: #E2C176;font-size: 28rpx;" class="">

					{{userInfoObject.level_id!=1?'当前您是尊贵vip会员':'vip会员等你来解锁'}}
				</view>
			</view>
			<view style="font-size: 24rpx;" class="activate flex" @click="activateMembershipFn()">
				{{userInfoObject.level_id!=1?'点击查看':'立即开通'}}
			</view>
		</view>
		<view class="myOrderCard">
			<view class="flex-align-center padding-bottom_20rpx">
				<view class=" line">

				</view>
				<view class="font-weight_bold  border-bottom-f7f7f7">
					我参与订单/服务
				</view>
			</view>
			<view class="flex-between" style="margin-top: 20rpx;">
				<block v-for="(item, i) in menuNavigationList" :key="i">
					<view class="flex-column " @click="checkOrderFn(item)">
						<image class="avaterIcon" :src="item.img" mode=""></image>
						<view class="rightContent">
							<text class="authorizationTitle">{{ item.text }}</text>
						</view>
					</view>

				</block>
			</view>


		</view>
		<view class="flex-between margin-top_20rpx">
			<view class="dynamicContainer flex-columns">
				<view class="flex-between" style="width: 100%;" @click="myUpdatesFn()">
					<view class="flex-start-center">
						<view class="font-weight " style="font-size: 30rpx;">
							我的动态
						</view>
						<view class="news flex" v-if="other_count!=0">
							<text>{{other_count>100?99:other_count}}</text>
						</view>
					</view>
					<view class="">
						<uni-icons type="right" size="15"></uni-icons>
					</view>
				</view>
				<view class="flex-start-center" style="width: 100%;" v-if="message.length">
					<block v-for="(item,index) in messageList" :key="index">
						<!-- 1是评论 -->
						<block v-if="item.type==1">
							<image class="avatar" :src="item.avatar" mode=""></image>
							<view class="font-overflow" style="width: 200rpx;">
								<text>评论了{{item.content}}</text>
							</view>
						</block>

						<block v-if="item.type==2">
							<image class="avatar" :src="item.avatar" mode=""></image>
							<view class="font-overflow" style="width: 200rpx;">
								<text>点赞了你的圈子</text>
							</view>
						</block>
						<block v-if="item.type==3">
							<image class="avatar" :src="item.avatar" mode=""></image>
							<view class="font-overflow" style="width: 200rpx;">
								<text>取消了圈子点赞</text>
							</view>
						</block>
						<block v-if="item.type==4">
							<image class="avatar" :src="item.avatar" mode=""></image>
							<view class="font-overflow" style="width: 200rpx;">
								<text>{{item.nickname}}回复了我</text>
							</view>
						</block>
						<block v-if="item.type==5">
							<image class="avatar" :src="item.avatar" mode=""></image>
							<view class="font-overflow" style="width: 200rpx;">
								<text>{{item.nickname}}点赞了你的评论</text>
							</view>
						</block>
						<block v-if="item.type==6">
							<image class="avatar" :src="item.avatar" mode=""></image>
							<view class="font-overflow" style="width: 200rpx;">
								<text>{{item.nickname}}取消了评论点赞</text>
							</view>
						</block>

					</block>
				</view>
				<view class="" v-else>
					<text>无人回复了我</text>

				</view>

			</view>
			<view class="followContainer flex-columns">
				<view class="flex-between" style="width: 100%;" @click="whoHasSeenMeFn()">
					<view class="flex-start-center">
						<view class="font-weight " style="font-size: 30rpx;">
							谁看过我
						</view>
						<view class="news flex" v-if="visitCount!=0">
							<text>{{visitCount>99?99:visitCount}}</text>
						</view>
					</view>
					<view class="">
						<uni-icons type="right" size="15"></uni-icons>
					</view>
				</view>
				<view class="flex-start-center" style="width: 100%;">
					<view class="">
						<view class="flex-between v-p-share" v-if="visitMeLogList.length">
							<view class="v-m-width not-font-overflow flex1">
								<block v-for="(item, index) in visitMeLogList" :key="index">
									<image v-if="index<3" class="pt_img" :src="item.avatar"></image>
								</block>

							</view>

						</view>
					</view>
					<!-- <image class="avatar" src="/static/第一行所有图标/矩形 141.png" mode=""></image> -->
					<view class="font-overflow">
						<text>{{myVisitLogCount}}人来过</text>
					</view>
				</view>
			</view>
		</view>
		<!-- v-if="userInfoObject&&userInfoObject.associateState==2" -->
		<view class="cardDetail flex-column-between">
			<view class="flex-between padding-bottom_20rpx border-bottom-f7f7f7">
				<view class="flex-align-center">
					<view class=" line">

					</view>
					<view class="font-weight_bold">
						收益数据
					</view>
				</view>
				<view class="flex" style="color: #999999;" v-if="basicConfiguration.withdrawal_switch==1"
					@click="myTeamFn()">
					<text>收益记录</text>
					<uni-icons color="#999" type="right" size="15"></uni-icons>
				</view>
			</view>
			<view class="flex-between padding_20rpx_0 border-bottom-f7f7f7">
				<view>
					<view class="margin-bottom_10rpx" style="color: #666666;">
						<text>可提现收益(收益)</text>
					</view>
					<view style="color: #A265FC;;" class="">
						<text style="font-size: 44rpx;">{{userInfoObject.surplus_income}}</text>
					</view>
				</view>
				<view v-if="basicConfiguration.withdrawal_switch==1" class="recharge flex" @click="withdrawal()">
					<text style="margin-left: 10rpx;">提现</text>
					<uni-icons color="#fff" type="right" size="15"></uni-icons>
				</view>
			</view>
			<view class="flex-between padding-top_20rpx">
				<view class="flex-column" v-for="(item,i) in monthDataDetails" :key="i">

					<view class="margin-bottom_10rpx" style="color:rgb(102, 102, 102);font-size: 28rpx;">
						{{item.text}}
					</view>
					<view class="font-weight_bold" style="color: rgb(51, 51, 51);font-size: 28rpx;">
						{{totelName(item.number)}}
					</view>

				</view>

			</view>
		</view>
		<view class="otherNavigation">
			<!-- <view class="flex-between" style="margin-top: 10rpx;">
				<block v-for="(item, i) in otherNavigationList" :key="i">
					<view class="flex-column " @click="checkOrderFn(item)">
						<image class="avaterIcon" :src="item.img" mode=""></image>
						<view class="rightContent" v-if="item.text=='明细'">
							<view class="authorizationTitle">{{currency_name}}{{ item.text }}</view>
						</view>
						<view class="rightContent" v-else>
							<view class="authorizationTitle">{{ item.text }}</view>
						</view>
					</view>

				</block>
			</view> -->
			<view class="navigationBot flex-wrap-justifyBetween">



				<block v-for="(item,index) in functionList" :key="index">

					<view class="flex-start-center margin-top_20rpx" style="width: 50%;" @click="navTo(item)">
						<image class="icon" :src="item.img" mode=""></image>
						<view class="flex-column-start">
							<view class="font-weight">
								{{item.text}}
							</view>
							<view class="">
								<text style="color: #999999;">{{item.title}}</text>
							</view>
						</view>
					</view>
				</block>
				<!-- 	<view class="flex-start-center margin-top_20rpx" style="width: 50%;">
					<image class="icon" src="../../static/用户中心图标/组合 804.png" mode=""></image>
					<view class="flex-column-start">
						<view class="font-weight">
							发布搭子
						</view>
						<view class="">
							<text style="color: #999999;">寻找合适的队友</text>
						</view>
					</view>
				</view>
				<view class="flex-start-center margin-top_20rpx" style="width: 50%;">
					<image class="icon" src="../../static/用户中心图标/组合 800.png" mode=""></image>
					<view class="flex-column-start">
						<view class="font-weight">
							联系客服
						</view>
						<view class="">
							<text style="color: #999999;">如有问题联系我们</text>
						</view>
					</view>
				</view>
				<view class="flex-start-center margin-top_20rpx" style="width: 50%;">
					<image class="icon" src="../../static/用户中心图标/组合 803.png" mode=""></image>
					<view class="flex-column-start">
						<view class="font-weight">
							实名认证
						</view>
						<view class="">
							<text style="color: #999999;">实名后发布任务赚钱</text>
						</view>
					</view>
				</view> -->
			</view>

		</view>
		<sunui-popup ref="myPackagePopup">
			<template v-slot:content>

				<view class="backgroundImg" :style="{ '--bg-image': `url(${basicConfiguration.invite_img})` }">

					<image class="qrcode" :src="userInfoObject.invite_xcx_url" mode=""></image>
				</view>
				
				<!-- <view class="v-poster-page">
			
					<image :src="path" mode="widthFix" @click="handlePreviewImg([path], 0)" class="v-border"></image>
				
					<sunui-painter
						isRenderBlob
						custom-style="position: fixed; left: 200%;"
						:isRenderImage="true"
						:board="basePainter"
						@success="getSuccessInfo"
						@fail="getFailInfo"
					></sunui-painter>
					<view class="flex-column" v-if="path">
						<view class="btnCss2 flex" @click="save()">保存图片</view>
						<view class="v-cancel" @click="cancel()">取消</view>
					</view>
				</view> -->
				

			</template>
		</sunui-popup>
		<sunui-popup ref="serviceItemsPopup">
			<template v-slot:content>

				<view class="serviceItemsContain ">
					<view class="top flex-between">
						<view class="">

						</view>
						<text>是否要成为合伙人</text>
						<uni-icons @click='closeWriteOffIcon()' class="uniIcon" type="clear" size="30"
							style="color: #07070791;">
						</uni-icons>
					</view>
					<view class="flex">
						<!-- 			<text class="font-size_56rpx"
							style="color: #6A68F7;">{{Math.floor(dazi_top_number * 100) / 100}}</text> -->
						<text style="margin-left: 10rpx;color: #6A68F7;">{{currency_name}}</text>
					</view>
					<view class="card">
						<view class="myNmae">

							<view class="">
								<input class="uni-inputsa" @input="changeInputTop" type="number" v-model="day"
									:placeholder="`输入成为合伙人需要的${currency_name}`" />
							</view>


						</view>

					</view>


					<view class="PublishTags flex" @click="payNow()">
						立即支付
					</view>

				</view>

			</template>
		</sunui-popup>
		<sunui-popup ref="modifyEmployeeInfo">
			<template v-slot:content>

				<view class="moreActiveButton">
					<view class="add" @click.stop="authorityFn(1)">
						去提现
					</view>
					<view class="add" @click.stop="authorityFn(2)">
						收益转余额
					</view>



				</view>

			</template>
		</sunui-popup>

		<ad :unit-id="unitId" v-if="unitId" class="padding_20rpx_0"></ad>
		<view class="" style="height: 150rpx;">

		</view>
		<tqb-tabbar activeIndex="4" />
	</view>
</template>

<script>
	import tqbTabbar from '../../components/tqb-tabbar/tqb-tabbar.vue'
	export default {
		components: {
			tqbTabbar
		},
		data() {
			return {
				path:'',
				basePainter:'',
				currency_name: uni.getStorageSync("system").currency_name,
				unitId: '',
				viporder: this.$img.viporder,
				bgCenter: this.$img.bgCenter,
				Community: this.$img.Community,
				yellowBrick: this.$img.yellowBrick,
				myService: this.$img.myService,
				crowns: this.$img.crowns,
				serviceOrde: this.$img.serviceOrde,
				path25:this.$img.path25,
				path69:this.$img.path69,
				basicConfiguration: {},
				userInfo: uni.getStorageSync("userInfo"),
				userInfoObject: null,
				title: 'Hello',
				myVisitLogCount: '',
				seconds: '',
				showBtn: false,
				messageList: [],
				obj2 : {
				    me_income: '',
				    me_is_only_child: "",
				    me_is_have_car: '',
				    me_is_have_house: "",
				    me_marital_status: '',
				    me_marriage_date: '',
				    me_ethnic: "",
				    ta_age_range:'',
				    ta_height_range:"",
				    ta_min_qualifications:'',
				    ta_income:'',
				    ta_marital_status:'',
				    ta_is_have_child:'',
				    ta_housing_requirements:'',
				    ta_personalities:"",
				    speech: '',
				    introduce: '',
				    height: '',
				    school: '',
				    img: '',
				    label: '',
				    avatar: '',
				    trade:'',
					me_qualifications:''
				},
				// 数据明细
				dataDetails: [{
						number: 0.00,
						text: '关注'
					},
					{
						number: 0.00,
						text: '粉丝'
					},
					{
						number: 0.00,
						text: '我的余额(' + uni.getStorageSync("system").currency_name + ')'
					},
					{
						number: 0.00,
						text: '我的收益(' + uni.getStorageSync("system").currency_name + ')'
					},
				],
				// 数据明细
				monthDataDetails: [{
						number: 0.00,
						text: '今年收益(' + uni.getStorageSync("system").currency_name + ')'
					},
					{
						number: 0.00,
						text: '本月收益(' + uni.getStorageSync("system").currency_name + ')'
					},
					{
						number: 0.00,
						text: '今日收益(' + uni.getStorageSync("system").currency_name + ')'
					},

				],
				visitMeLogList: [],
				myVisitLogList: [],
				message: [],
				detailInfo: [],
				other_count: '',
				visitCount: '',
				getConfig: '',
				isAndroid:true,
				percentage:0,
				menuNavigationList: [{
						img: this.$img.taskUser,
						text: '搭子订单',
						url: '/pagesA/personalCenter/buildingOrder',
						index: 2
					},
					{
						img: this.$img.task,
						text: '服务订单',
						index: 5,
						url: '/pagesA/personalCenter/serviceOrdersUser'
					},
					{
						img: this.$img.Community,
						text: '社群订单',
						index: 1,
						url: '/pagesA/personalCenter/joinedGroup'
					},
					{
						img: this.$img.viporder,
						text: 'vip订单',
						index: 3,
						url: '/pagesA/personalCenter/purchaseRecords'
					},
					// {
					// 	img: '../../static/微信图片_20240719164247.png',
					// 	text: '查看手机号',
					// 	index: 4,
					// 	url: '/pagesA/personalCenter/mobileTransactionRecords'
					// },
					// {
					// 	img:this.$img.gogo,
					// 	text: '搭子管理',
					// 	index: 1,
					// 	url: '/pagesA/personalCenter/buildingOrderManagement'
					// },

					// {
					// 	img: this.$img.square,
					// 	text: '服务管理',
					// 	index: 3,
					// 	url: '/pagesA/personalCenter/serviceManagement'
					// },



				],
				functionList: [{
						img: this.$img.handshake,
						text: '我的搭子',
						title: '我发布的搭子管理',
						url: '/pagesA/personalCenter/buildingManagement'
					},
					{

						text: '搭子订单管理',
						title: '报名我的搭子订单',
						img: this.$img.flag,
						url: '/pagesA/personalCenter/buildingOrderManagement'
					},
					{

						text: '我的服务',
						title: '我发布的服务项目',
						img: this.$img.myService,
						url: '/pagesA/personalCenter/serviceManagement'
					},
					{

						text: '服务订单',
						title: '我的服务预约订单',
						img: this.$img.serviceOrde,
						url: '/pagesA/personalCenter/serviceOrders'
					},
					{

						text: '加入社群',
						title: '我加入的社群',
						img: this.$img.taskGogo,
						url: '/pagesA/personalCenter/joinedGroup'
					},

					{

						text: '圈子管理',
						title: '发布管理圈子动态',
						img: this.$img.circle,
						url: '/pagesA/personalCenter/dynamicManagement'
					},
					{

						text: uni.getStorageSync("system").currency_name + '收益',
						title: uni.getStorageSync("system").currency_name + '支出/收益明细',
						img: '../../static/微信图片_20240816110038.png',
						url: '/pagesA/personalCenter/brickStoneRevenue'
					},
					{

						text: uni.getStorageSync("userInfo").associateState == 2 ? '合伙人中心' : "申请合伙人",
						title: '获得更多额外变现',
						img: '../../static/微信图片_20240816110133.png',
						// url: '/pagesA/personalCenter/distributionCenter'
						url: uni.getStorageSync("userInfo").associateState == 2 ?
							'/pagesA/personalCenter/distributionCenter' : '/pagesB/index/applyDistributor'
					},
					{
						img: this.$img.customer,
						text: '联系客服',
						title: '如有问题联系我们',
						phone: 'true'
						// url: '/pages/statistics/index/index'
					}, { 
						img: this.$img.taskEdit,
						text: uni.getStorageSync("userInfo").real_name||(!Number(uni.getStorageSync("system").isOpen_idCard_authentication)) ? '填写资料' : '实名认证',
						title: uni.getStorageSync("userInfo").real_name||(!Number(uni.getStorageSync("system").isOpen_idCard_authentication))  ? '完善资料送' + uni.getStorageSync("system")
							.fill_information_send_coins + uni.getStorageSync("system")
							.currency_name : '实名认证后送' + uni.getStorageSync("system")
							.idCard_number_authentication_send_coins + uni.getStorageSync("system").currency_name,
						url: uni.getStorageSync("userInfo").real_name ||(!Number(uni.getStorageSync("system").isOpen_idCard_authentication)) ? '/pagesA/personalCenter/realAuthentication' :
							'/pagesA/personalCenter/informationIdCard'
					},
					{
						img: '../../static/微信图片_20240820120238.png',
						text: '推广海报',
						title: '分享邀请用户',
						url: 'poster'
					},
					{
						img: '../../static/微信图片_20240826110609.png',
						text: '推广员中心',
						title: '随时随地查看明细',
						url: '/pagesB/index/promoterLogin'

					},
					// ,{
					// 	img: this.$img.aaa,
					// 	text: '社群管理',
					// 	title: '管理自己发布社群',
					// 	url: '/pagesA/personalCenter/myCommunityList'
					// },{
					// 	img: this.$img.bbb,
					// 	text: '发布社群',
					// 	title: '发布新的社群信息',
					// 	url: '/pagesA/personalCenter/addCommunity'
					// },
				],
				otherNavigationList: [{
						img: this.$img.taskHeart,
						text: '推广海报',
						index: 1,
						url: 'poster'
					},
					{
						img: this.$img.moneny,
						text: '明细',
						url: '/pagesA/personalCenter/brickStoneRevenue',
						index: 2
					},
					{
						img: this.$img.addingGroups,
						text: '我的团队',
						index: 3,
						url: '/pagesA/personalCenter/myFans'
					},
					{
						img: this.$img.distribution,
						text: '推广中心',
						index: 5,
						url: '/pagesA/personalCenter/distributionCenter'
					},


				],

			}
		},
		onLoad() {
			// this.userInfoFn()
			// this.basicConfigurationFn()

			// this.init()
			// this.unReadMessageFn()
			
			// this.functionListFn()
			// this.configFn()
		},
		onShow() {
			this.unReadMessageFn()
			this.basicConfigurationFn()
			// this.configFn()
			this.init()
			this.userInfoFn()
			wx.getSystemInfo({
				success: (res) => {
					let platform = res.system;
			
					if (platform.indexOf('Android') !== -1) {
						this.isAndroid = true
			
						console.log('用户使用安卓设备');
			
					} else if (platform.indexOf('iOS') !== -1) {
						this.isAndroid = false
						// uni.showModal({
						// 	title: '提示',
						// 	content: '是否跳转到联系我们页面',
						// 	success: async (res) => {
						// 		if (res.confirm) {
						//              this.$sun.navGo('/pagesA/personalCenter/contactUs')
			
						// 		} else if (res.cancel) {
			
						// 		}
						// 	}
						// });
						console.log('用户使用苹果设备');
					}
				}
			});
			// this.functionListFn()
		},
		created() {

			// this.userInfoFn()
			// this.init()
			// this.basicConfigurationFn()
			// this.unReadMessageFn()
			// this.configFn()



		},
		computed: {

			totelName: function() {
				return function(num) {

					if (num >= 10000) {
						let remainder = num % 10000;
						let quotient = Math.floor(num / 10000);
						let decimal = Math.floor(remainder / 1000);
						return quotient + '.' + decimal + '万';
					} else {
						return num.toString();
					}
				};
			}
		},
		methods: {
			
			async templateTpo() {
				wx.requestSubscribeMessage({
					tmplIds: JSON.parse(JSON.stringify(uni.getStorageSync("messageListTemplate"))),
					success: res => { //成功、
						if (res[Object.keys(res)[0]] == "accept") {
							console.log("成功订阅")
							// this.$sun.toast("成功订阅")
						} else {
							this.$sun.toast(
								"点击右上角的「...」按钮，找到「订阅消息」相关选项，并设定为「接收」状态方可再次订阅")
				
							uni.showModal({
								title: "温馨提示",
								content: "点击右上角的「...」按钮，找到「订阅消息」相关选项，并设定为「接收」状态方可再次订阅"
							})
						}
					},
					fail: err => { //失败
						console.log(err)
						this.$sun.toast("订阅消息配置失败");
					}
				})
				
				
				
				// wx.getSetting({
				// 	success(res) {
				// 		console.log(res)
				// 		if (res.subscriptionsSetting) {
				// 			// 用户有pushSubscription对象
				// 			const pushSubscription = res.subscriptionsSetting['message.subscribe.send']
				// 			if (pushSubscription) {
				// 				// 用户已订阅
				// 				console.log('用户已订阅')
				// 				this.$sun.toast("用户已订阅")
				// 			} else {
				// 				wx.requestSubscribeMessage({
				// 					tmplIds: ['Y04lXw-tkuSAdFi77o5BPCJij1Z9fq7e4ZbIYidgm20'],
				// 					success: res => { //成功、
				// 						if (res[Object.keys(res)[0]] == "accept") {
				// 							console.log("成功订阅")
				// 							this.$sun.toast("成功订阅")
				// 						} else {
				// 							this.$sun.toast(
				// 								"点击右上角的「...」按钮，找到「订阅消息」相关选项，并设定为「接收」状态方可再次订阅")
			
				// 							uni.showModal({
				// 								title: "温馨提示",
				// 								content: "点击右上角的「...」按钮，找到「订阅消息」相关选项，并设定为「接收」状态方可再次订阅"
				// 							})
				// 						}
				// 					},
				// 					fail: err => { //失败
				// 						console.log("订阅消息配置失败")
				// 						this.$sun.toast("订阅消息配置失败");
				// 					}
				// 				})
						
				// 			}
				// 		} else {
				// 			this.$sun.toast("无法获取订阅状态")
				// 			// 用户没有pushSubscription对象，可能是微信版本过低或者用户未允许小程序获取该权限
				// 			console.log('无法获取订阅状态')
				// 		}
				// 	},
				// 	fail() {
				// 		// 获取设置失败的处理逻辑
				// 	}
				// })
			
			
			
			
			
			},
			toMaterialFn(){
				if( this.userInfoObject.real_name||(!Number(this.basicConfiguration.isOpen_idCard_authentication))){
					this.$sun.navGo('/pagesA/personalCenter/realAuthentication')
				}else{
					this.$sun.toast('请实名以后在完善资料','none')
				}
				
			},
			functionListFn() {
				this.$nextTick(() => {
					console.log(this.functionList[7], uni.getStorageSync("userInfo").associateState)
					this.functionList[7] = {

						text: this.userInfoObject.associateState == 2 ? '合伙人中心' : "申请合伙人",
						title: '获得更多额外变现',
						img: '../../static/微信图片_20240816110133.png',
						// url: '/pagesA/personalCenter/distributionCenter'
						url: this.userInfoObject.associateState == 2 ?
							'/pagesA/personalCenter/distributionCenter' : '/pagesB/index/applyDistributor'
					}
					console.log(this.functionList[9], uni.getStorageSync("userInfo").real_name)
					this.functionList[9] = {
						img: this.$img.taskEdit,
						text: this.userInfoObject.real_name ||(!Number(this.basicConfiguration.isOpen_idCard_authentication))? '填写资料' : '实名认证',
						title: this.userInfoObject.real_name ||(!Number(this.basicConfiguration.isOpen_idCard_authentication)) ? '完善资料送' + uni.getStorageSync(
								"system").fill_information_send_coins + uni.getStorageSync("system")
							.currency_name : '实名认证后送' + uni.getStorageSync("system")
							.idCard_number_authentication_send_coins + uni.getStorageSync("system")
							.currency_name,
						url: this.userInfoObject.real_name||(!Number(this.basicConfiguration.isOpen_idCard_authentication)) ?
							'/pagesA/personalCenter/realAuthentication' :
							'/pagesA/personalCenter/informationIdCard'
					}

				})
			},
			withdrawal() {
				this.$refs.modifyEmployeeInfo.show({
					anim: 'bottom',
					position: 'bottom',
					shadeClose: true, //false使用户不能点击其它关闭页面
					topclose: false,
					zIndex: 100000,
				});
			// 	uni.chooseVideo({
			// 		compressed: false,
					
			// 		success: (res) => {
			// 			console.log(res)
			// 			uni.compressVideo({
			// 				src: res.tempFilePath,
			// 				quality: 'high',
			// 				success: (resss) => { // 压缩成功 
			// 				console.log('err：', resss);
							
			// 				uni.uploadFile({
			// 					url: this.$api.upload,
			// 					filePath: resss.tempFilePath,
			// 					name: 'file',
							
			// 					header: null,
			// 					success: uploadRes => {
			// 						console.log('uploadRes-------------',
			// 							uploadRes, 'this.formData', this
			// 							.formData,
			// 							'this.uploadServerUrl', this
			// 							.uploadServerUrl);
			// 						/* 阿里云上传 */			
			// 						/* 七牛云上传 */
			// 						uploadRes = JSON.parse(uploadRes.data);
			// 				         	console.log('err：', uploadRes);		
			// 					},
			// 					fail: e => {
			// 						uni.showToast({
			// 							title: '上传录音失败',
			// 							icon: 'none'
			// 						});					
			// 					}
			// 				});		
			// 				},
			// 				fail: (err) => { 
			// 					// 压缩失败
			// 					console.log('err：', err);
			// 				}
			// 			});
			// 		}
			// 	});
				// 是需要去提现还是把收益转为余额

				// this.$sun.navGo('/pagesA/personalCenter/applyWithdrawal')

				// this.$sun.navGo('/pagesA/personalCenter/brickStoneRevenue')
			},
			myTeamFn() {
				// this.$sun.navGo('/pagesA/personalCenter/myFans')

				this.$sun.navGo('/pagesA/personalCenter/brickStoneRevenue', {
					amount_type: 2
				})
			},
			tabFollowFn(item) {
				console.log(item)
				if (item.text == '关注') {

					uni.redirectTo({
						url: '/pages/index/listfollowMe'
					})
				}
				if (item.text == '粉丝') {
					this.$sun.navGo('/pages/index/listfollow')


				}
				if (item.text == '我的余额(' + uni.getStorageSync("system").currency_name + ')') {
					this.$sun.navGo('/pagesA/personalCenter/brickStoneRevenue', {
						amount_type: 1
					})
				}
				if (item.text == '我的收益(' + uni.getStorageSync("system").currency_name + ')') {
					this.$sun.navGo('/pagesA/personalCenter/brickStoneRevenue', {
						amount_type: 2
					})
				}
			},
			adError(e) {
				console.log(e)
			},
			authorityFn(index) {
				this.$refs.modifyEmployeeInfo.close()
				if (index == 1) {
					// this.$sun.navGo('/pagesA/personalCenter/applyWithdrawal')
					this.$sun.navGo('/pagesA/personalCenter/distributionRecords', {
						type: 1
					})
				} else {
					this.$sun.navGo('/pagesB/index/revenueBalanceConversion')
				}

			},

			async unReadMessageFn() {
				const res = await this.$http.post({
					url: this.$api.unReadMessage,
					data: {






					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})


				if (res.code == 0) {

					console.log(res.data.notice_count)
					this.other_count = res.data.other_count
					this.visitCount = res.data.visitCount

				} else {
					this.$sun.toast(res.message, 'none')
				}
			},

			async readNoticeMessageFn() {
				// 
				const resPoster = await this.$http.post({
					url: this.$api.readNoticeMessage,
					data: {

						type: 2,


					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})

				if (resPoster.code == 0) {
					console.log(resPoster)
					this.$sun.navGo('/pagesA/personalCenter/myUpdates')

				} else {

					this.$sun.toast(resPoster.message, 'none')
				}

			},
			whoHasSeenMeFn() {
				this.$sun.navGo('/pagesA/personalCenter/whoHasSeenMe')
			},
			
			rechargeNowFn() {
				
				this.templateTpo()

				// 判断是安卓还是苹果
				this.$sun.navGo('/pagesA/personalCenter/onlineRecharge')


			},
			activateMembershipFn() {
				this.templateTpo()
				this.$sun.navGo('/pagesA/personalCenter/memberCenter')
			},
			myUpdatesFn() {
				this.readNoticeMessageFn()
				// this.$sun.navGo('/pagesA/personalCenter/myUpdates')
			},
			async configFn() {

				const resConfig = await this.$http.post({
					url: this.$api.config,
					data: {

					},
					headers: {

					}

				})

				if (resConfig.code == 0) {




					// this.$sun.toast(resConfig.message, 'none')
					this.getConfig = resConfig.data
					wx.setStorageSync('system', resConfig.data);

					console.log(this.getConfig, 'this.getConfig')

				} else {

					this.$sun.toast(resConfig.message, 'none')
				}



			},
			async init() {
				const result = await this.$http.post({
					url: this.$api.visitMeLog,
					data: {
						page: 1,
						limit: 10



					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})
				if (result.code == 0) {
					this.visitMeLogList = result.data.list
					this.myVisitLogCount = result.data.count
				}
				const res = await this.$http.post({
					url: this.$api.myVisitLog,
					data: {
						page: 1,
						limit: 10



					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})
				if (res.code == 0) {
					this.myVisitLogList = res.data.list

				}

				const resMessage = await this.$http.post({
					url: this.$api.message,
					data: {
						type: 2,
						page: 1,
						limit: 100



					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})
				if (resMessage.code == 0) {
					this.message = resMessage.data.list
					if (this.message.length) {
						this.messageList = [this.message[0]]
					}
					// this.messageList = resMessage.data.list.filter((item) => {
					// 	return item.type == 4
					// })
					// if (this.messageList.length) {
					// 	this.messageList = [this.messageList[0]]
					// }
					// console.log(this.messageList)
				}

			},
			async basicConfigurationFn() {
				const result = await this.$http.post({
					url: this.$api.config,
					data: {


					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})
				if (result.code == 0) {
					console.log(result)
					this.basicConfiguration = result.data
					wx.setStorageSync('system', result.data);
					this.unitId = result.data.advertisement_id
					console.log(this.unitId)
				
					
					

				}
				const res = await this.$http.post({
					url: this.$api.income,
					data: {


					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})
				console.log(res)
				if (res.code == 0) {
					// 跳转到登录页面
					this.myTeam = res.data
					this.monthDataDetails.forEach((item) => {
						switch (item.text) {
							case '今年收益(' + uni.getStorageSync("system").currency_name + ')':
								item.number = res.data.year_amount;
								break;
							case '本月收益(' + uni.getStorageSync("system").currency_name + ')':
								item.number = res.data.month_amount;
								break;
							case '今日收益(' + uni.getStorageSync("system").currency_name + ')':
								item.number = res.data.today_amount;
								break;

						}
					})

					console.log(res.data)
					// this.$sun.toast(res.message, 'none')
				} else {

					this.$sun.toast(res.message, 'none')
				}
			},
			countEmptyFields(obj1, obj2) {
			    let count = 0;
			    for (const key in obj1) {
			        if (obj1.hasOwnProperty(key) && obj2.hasOwnProperty(key)) {
			            if ((obj1[key] === null||obj1[key] === '') && obj2[key] === '') {
			                count++;
			            }
			        }
			    }
			    return count;
			},
			async userInfoFn() {
				const result = await this.$http.post({
					url: this.$api.userInfo,
					data: {

						// id:this.userInfo.id


					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})

				if (result.code == 0) {
					console.log('data', result.data);
					wx.setStorageSync('userInfo', result.data);
					this.userInfoObject = result.data
						const emptyFieldCount = this.countEmptyFields(this.userInfoObject, this.obj2);
						console.log(emptyFieldCount)
						this.percentage =  Math.round((( 24-Number(emptyFieldCount))/ 24 ) * 100);
						console.log(this.percentage)
					
					this.dataDetails.forEach((item) => {
						switch (item.text) {
							case '关注':
								item.number = result.data.follow;
								break;
							case '粉丝':
								item.number = result.data.fans;
								break;
							case '我的余额(' + uni.getStorageSync("system").currency_name + ')':
								item.number = result.data.balance;
								break;
							case '我的收益(' + uni.getStorageSync("system").currency_name + ')':
								item.number = result.data.total_income ? result.data.total_income : result.data
									.surplus_income;

								break;
								// 可根据实际情况继续添加其他匹配条件
						}
					})
					this.functionListFn()

				}
			},
			navTo(item) {

				if (item.text == '申请合伙人') {
					// this.$sun.toast('当前功能正在开发中敬请期待', 'none')

					if (uni.getStorageSync("userInfo").phone && (uni.getStorageSync("userInfo").real_name||(!Number(this.basicConfiguration.isOpen_idCard_authentication)))) {
						if (uni.getStorageSync("userInfo").associateState) {
							this.$sun.navGo('/pagesB/index/auditStatus');

						} else {
							this.$sun.navGo('/pagesB/index/applyDistributor');
							// 是否有开关 如果付费进行弹框
							// if(){

							// }
							// this.$sun.navGo(item.url);
							// this.$refs.serviceItemsPopup.show({
							// 	anim: 'bottom',
							// 	position: 'bottom',
							// 	shadeClose: false, //false使用户不能点击其它关闭页面
							// 	topclose: false,
							// 	zIndex: 99999
							// });
						}

					} else{
						if((!Number(this.basicConfiguration.isOpen_idCard_authentication))){
							this.$sun.toast('请验证手机号后在申请', 'none')
						}else{
							this.$sun.toast('请实名认证和验证手机号后在申请', 'none')
							
						}
						
					}

				} else {
					if (item.url == 'poster') {
						
						this.$sun.navGo('/pagesA/personalCenter/promotionPoster')
						// this.$refs.myPackagePopup.show({
						// 	style: 'padding:50rpx;',
						// 	bottomClose: true,
						// 	shadeClose: true,
						// 	topclose: true
						// });
					}
					if (item.phone) {
						if (this.basicConfiguration.customer_service) {

							this.$sun.navGo('/pagesA/personalCenter/contactUs')
							// uni.setClipboardData({
							// 	data: this.basicConfiguration.customer_service
							// });
						} else {
							this.$sun.toast('后台没有配置客服电话请联系管理员', 'none')
						}


					} else {
						if (item.text == uni.getStorageSync("system").currency_name + '收益') {
							this.$sun.navGo('/pagesA/personalCenter/brickStoneRevenue', {
								amount_type: 1
							})
						} else {
							if (uni.getStorageSync("userInfo").disable == 0) {
								this.$sun.toast('该用户已经被拉黑', 'none')

							} else {
								this.$sun.navGo(item.url);
							}

						}
					}
				}

			},
			checkOrderFn(item) {
				if (item.url == 'poster') {
					this.$nextTick(() => {
						console.log(this.userInfo.invite_xcx_url)
						this.$refs.myPackagePopup.show({
							style: 'padding:50rpx;',
							bottomClose: true,
							shadeClose: true,
							topclose: true
						});
					})
				} else {
					this.$sun.navGo(item.url);
				}
			}


		}
	}
</script>

<style lang="less" scoped>
	.bgIndex {


		.female {
			width: 96rpx;
			height: 36rpx;
			border-radius: 20rpx;
			color: #fff;
			background: #FA5799;

			.femaleImg {
				
				width: 20.96rpx !important;
				height: 20.96rpx !important;
				margin-right: 15rpx;
			}
		}

		.male {
			width: 96rpx;
			height: 36rpx;
			border-radius: 20rpx;
			color: #fff;
			background: rgb(1, 145, 255);

			.femaleImg {
				
				width: 20.96rpx !important;
				height: 20.96rpx !important;
				margin-right: 15rpx;
			}

			.maleImg {
				
				width: 20.96rpx !important;
				height: 20.96rpx !important;
				margin-right: 15rpx;
			}
		}

		.editingDegree {
			margin-right: 10rpx;
			width: 154rpx;
			height: 36rpx;
			background: #505050;
			color: #fff;
			border-radius: 20rpx;

		}

		.moreActiveButton {


			background-color: #fff;

			.flex-center() {
				display: flex;
				justify-content: center;
				align-items: center;
			}

			.moreActiveButton {


				background-color: #fff;


				.add {
					height: 100rpx;
					color: #6568F6;
					font-size: 28rpx;
					font-family: Inter;

					.flex-center();
					border: 2rpx solid #f7f7f7;


				}

				.delete {
					.flex-center();
					height: 100rpx;


					color: #FF4636;
					font-size: 28rpx;
					font-family: Inter;
					box-shadow: 2rpx 2rpx 2rpx 30rpx 30rpx rgba(238, 238, 238, 1.0);
				}


			}

			.add {
				height: 100rpx;
				color: #6568F6;
				font-size: 28rpx;
				font-family: Inter;

				.flex-center();
				border: 1px solid #f7f7f7;


			}

			.delete {
				.flex-center();
				height: 100rpx;


				color: #FF4636;
				font-size: 28rpx;
				font-family: Inter;
				box-shadow: 2rpx 2rpx 2rpx 30rpx 30rpx rgba(238, 238, 238, 1.0);
			}


		}

		.PublishTags {
			z-index: 99;
			margin-top: 10rpx;
			height: 102rpx;
			border-radius: 142rpx;
			color: #fff;


			bottom: 20rpx;
			background: rgb(120, 93, 246);
		}

		.serviceItemsContain {
			padding: 0rpx 30rpx 30rpx 30rpx;
			background-color: #fff;

			height: auto;
			overflow-x: auto;

			.myNmae {

				background-color: #fff;
				min-width: 50rpx;

				.avatar {
					width: 84rpx;
					height: 84rpx;
				}

				input {
					text-align: left;
				}

				.uni-input {

					height: 100rpx;
				}

				.uni-inputsa {
					width: 100%;
					height: 90rpx;
					border-radius: 20rpx;
					background: rgb(245, 245, 245);
					margin: 20rpx 0;
					padding: 0rpx 20rpx;
				}

				.uni-inputs {
					text-align: left !important;
				}

				.backgroundImg {

					height: 154rpx;


				}

			}





			.top {
				padding: 30rpx 0;
				width: 100%;

				text {
					color: rgb(0, 0, 0);
					font-size: 36rpx;
					font-weight: 400;
				}
			}

		}

		padding: 0 30rpx;
		background-repeat: no-repeat;
		background-size: cover;
		background-image: (var(--bg-image));
		// background-image: url('http://yunhunjian123.oss-cn-shanghai.aliyuncs.com/2024-06-13/d7a74202406131514238381.png');
		height: 50vh;

		.noVip {
			width: 136rpx;
			height: 40rpx;
		}

		.Vip {
			width: 136rpx;
			height: 40rpx;
		}

		.backgroundImg {

			width: 696rpx;
			height: 860rpx;
			background-repeat: no-repeat;
			background-size: contain;
			background-image: (var(--bg-image));
			position: relative;

			.qrcode {
				width: 245rpx;
				height: 245rpx;
				position: absolute;
				bottom: 104rpx;
				left: 225rpx;
			}
		}

		.avatar {
			width: 104rpx;
			height: 104rpx;
			border-radius: 50%;

		}

		.collectBricks {
			.bricksImg {
				width: 30rpx;
				height: 30rpx;
				margin-right: 8rpx;
			}

			margin-right: -30rpx;
			width: 158rpx;

			height: 48rpx;
			border-radius: 30rpx 0rpx 0rpx 30rpx;
			background: linear-gradient(180.00deg, rgb(252, 242, 232), rgb(252, 223, 167) 100%);
		}

		.dataDetails {
			margin-top: 50rpx;
		}

		.bgBlock {
			margin-top: 30rpx;
			height: 100rpx;
			border-radius: 20rpx;
			padding: 20rpx;
			background: rgb(41, 47, 68);

			.crownImg {
				width: 46rpx;
				height: 39.94rpx;
				margin-right: 10rpx;
			}

			.activate {
				width: 160rpx;
				height: 64rpx;
				border-radius: 122rpx;
				color: #fff;
				background: linear-gradient(90.00deg, rgb(226, 193, 118), rgb(246, 212, 134) 100%);
			}
		}

		.cardDetail {
			.line {
				width: 10rpx;
				height: 30rpx;
				border-radius: 106rpx;
				margin-right: 10rpx;
				background: rgb(120, 93, 246);
			}

			margin: 20rpx 0;

			border-radius: 10rpx;

			background: rgb(255, 255, 255);
			padding: 20rpx;

			.recharge {
				width: 152rpx;
				height: 68rpx;
				border-radius: 200rpx;
				color: rgb(255, 255, 255);
				background: #A265FC;
			}
		}

		// 我的订单
		.myOrderCard {
			.line {
				width: 10rpx;
				height: 30rpx;
				border-radius: 106rpx;
				margin-right: 10rpx;
				background: rgb(120, 93, 246);
			}

			border-radius: 20rpx;
			margin-top: 22rpx;
			background: rgb(255, 255, 255);
			padding: 20rpx;

			.myOrder {
				padding-bottom: 25rpx;
				border-bottom: 2rpx solid rgb(237, 237, 237);
			}

			.avaterIcon {
				width: 85rpx;
				height: 85rpx;
				margin-bottom: 14rpx;
			}

			.infoBox {
				width: 25%;
				margin-bottom: 10rpx;
			}

			.rightContent {
				.authorizationTitle {
					color: #060606;
					// font-size: 28rpx;
					// font-weight: 600;
					margin-bottom: 20rpx;
				}

				.moreToolTitle {
					color: #666666;
					font-size: 28rpx;
					font-weight: 600;
					margin-bottom: 11rpx;
				}

				.authorizationText {
					color: #666;
					font-family: Inter;
					font-size: 24rpx;
				}
			}
		}

		.dynamicContainer {
			padding: 20rpx 40rpx;
			width: 336rpx;
			height: 170rpx;
			border-radius: 20rpx;

			background: rgb(255, 255, 255);

			.avatar {
				width: 60rpx;
				height: 60rpx;
				margin-right: 15rpx;

			}

			.news {
				width: 40rpx;
				height: 40rpx;
				background-color: red;
				border-radius: 50%;
				color: #fff;
				margin-left: 10rpx;
			}
		}

		.followContainer {
			padding: 20rpx 40rpx;
			width: 336rpx;
			height: 170rpx;
			border-radius: 20rpx;

			background: rgb(255, 255, 255);

			.avatar {
				width: 60rpx;
				height: 60rpx;
				margin-right: 25rpx;

			}

			.v-p-share {
				padding: 2rpx 2rpx 0 2rpx;

				.v-m-width {
					margin-right: 40rpx;

					.pt_img {
						width: 50rpx;
						height: 50rpx;
						margin-right: -30rpx;
						border-radius: 50%;
					}
				}

				.v-share-friend {
					text {
						color: #294d7d;
						font-size: 24rpx;
						padding-right: 50rpx;
					}

					view {
						color: #ffffff;
						width: 154rpx;
						height: 58rpx;
					}
				}

				.v-share-friend2 {
					text {
						color: #294d7d;
						font-size: 24rpx;
					}
				}
			}

			.news {
				width: 40rpx;
				height: 40rpx;
				background-color: red;
				border-radius: 50%;
				color: #fff;
				margin-left: 10rpx;
			}
		}

		.otherNavigation {

			border-radius: 10px;
			padding: 20rpx;
			margin-top: 20rpx;
			background: rgb(255, 255, 255);
			margin-bottom: 20rpx;

			.myOrder {
				padding-bottom: 25rpx;
				border-bottom: 2rpx solid rgb(237, 237, 237);
			}

			.avaterIcon {
				width: 96rpx;
				height: 96rpx;
				margin-bottom: 14rpx;
			}

			.infoBox {
				width: 25%;
				margin-bottom: 10rpx;
			}

			.rightContent {
				.authorizationTitle {
					color: #333333;
					font-size: 28rpx;
					// font-weight: 600;
					margin-bottom: 20rpx;
				}

				.moreToolTitle {
					color: #666666;
					font-size: 28rpx;
					font-weight: 600;
					margin-bottom: 11rpx;
				}

				.authorizationText {
					color: #666;
					font-family: Inter;
					font-size: 24rpx;
				}
			}

			.navigationBot {


				.icon {
					width: 118rpx;
					height: 118rpx;
				}

			}
		}

	}
</style>